﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DCT.Model;

namespace DCT.ViewModel
{
    public class MiscellaneousDeviceViewModel : DeviceBaseViewModel
    {
        #region Constructor

        public MiscellaneousDeviceViewModel(MiscellaneousDeviceModel mdModel, MiscellaneousDeviceGraphModel mdGraphModel)
            : base(mdModel, mdGraphModel)
        {
            if (mdModel == null)
                throw new ArgumentNullException("MiscellaneousDeviceModel");

            if (mdGraphModel == null)
                throw new ArgumentNullException("MiscellaneousDeviceGraphModel");

            _mdModel = mdModel;
            _mdGraphModel = mdGraphModel;
        }

        #endregion // Constructor

        #region Fields

        MiscellaneousDeviceModel _mdModel;
        MiscellaneousDeviceGraphModel _mdGraphModel;

        #endregion // Fields

        #region Delegates

        public delegate void UpdateVisualDelegate();
        public UpdateVisualDelegate UpdateVisual;

        #endregion //Delegates

        #region Properties

        public MiscellaneousDeviceModel MDModel
        {
            get
            {
                return _mdModel;
            }
        }

        public MiscellaneousDeviceGraphModel MDGraphModel
        {
            get
            {
                return _mdGraphModel;
            }
        }

        public string MDSubType
        {
            get
            {
                return _mdModel.MDSubType;
            }
            set
            {
                if (value != _mdModel.MDSubType)
                {
                    this.InsertUnDoRedoForProperty("MDSubType", value, this.MDSubType);

                    _mdModel.MDSubType = value;
                    base.OnPropertyChanged("MDSubType");
                }
            }
        }

        public string MDString
        {
            get
            {
                return _mdGraphModel.MDString;
            }
            set
            {
                if (value != _mdGraphModel.MDString)
                {
                    this.InsertUnDoRedoForProperty("MDString", value, this.MDString);

                    _mdGraphModel.MDString = value;
                    base.OnPropertyChanged("MDString");
                    this.UpdateVisual();
                }
            }
        }

        public string MDBitmap
        {
            get
            {
                return _mdGraphModel.MDBitmap;
            }
            set
            {
                if (value != _mdGraphModel.MDBitmap)
                {
                    this.InsertUnDoRedoForProperty("MDBitmap", value, this.MDBitmap);

                    _mdGraphModel.MDBitmap = value;
                    base.OnPropertyChanged("MDBitmap");
                    this.UpdateVisual();
                }
            }
        }

        #endregion //Properties
    }
}
